home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / puma.lha / puma / m2c / Optimize.c < prev    next >
C/C++ Source or Header  |  1992-09-25  |  59KB  |  2,156 lines

  1. #include "SYSTEM_.h"
  2.  
  3. #ifndef DEFINITION_System
  4. #include "System.h"
  5. #endif
  6.  
  7. #ifndef DEFINITION_IO
  8. #include "IO.h"
  9. #endif
  10.  
  11. #ifndef DEFINITION_Tree
  12. #include "Tree.h"
  13. #endif
  14.  
  15. #ifndef DEFINITION_IO
  16. #include "IO.h"
  17. #endif
  18.  
  19. #ifndef DEFINITION_Idents
  20. #include "Idents.h"
  21. #endif
  22.  
  23. #ifndef DEFINITION_Mod
  24. #include "Mod.h"
  25. #endif
  26.  
  27. #ifndef DEFINITION_Tree
  28. #include "Tree.h"
  29. #endif
  30.  
  31. #ifndef DEFINITION_Scanner
  32. #include "Scanner.h"
  33. #endif
  34.  
  35. #ifndef DEFINITION_Positions
  36. #include "Positions.h"
  37. #endif
  38.  
  39. #ifndef DEFINITION_Sets
  40. #include "Sets.h"
  41. #endif
  42.  
  43. #ifndef DEFINITION_Sets
  44. #include "Sets.h"
  45. #endif
  46.  
  47. #ifndef DEFINITION_Optimize
  48. #include "Optimize.h"
  49. #endif
  50.  
  51. IO_tFile Optimize_yyf;
  52. PROC Optimize_Exit;
  53.  
  54. static BOOLEAN gHasExit, gHasAssign, gHasTargetCode, gHasRejectOrFail;
  55. static Tree_tTree gRule, nNoDecision, nNoTest;
  56. static BOOLEAN IsDisjoint ARGS((Sets_tSet s1, Sets_tSet s2));
  57. static void yyAbort ARGS((CHAR yyFunction[], LONGCARD ));
  58. static BOOLEAN yyIsEqual ARGS((BYTE yya[], LONGCARD , BYTE yyb[], LONGCARD ));
  59. struct S_3 {
  60.     union {
  61.         struct {
  62.             struct S_5 {
  63.                 Tree_tTree yyV1;
  64.                 Tree_tTree yyV2;
  65.             } yyR1;
  66.         } V_1;
  67.         struct {
  68.             struct S_4 {
  69.                 Tree_tTree yyV1;
  70.                 Tree_tTree yyV2;
  71.                 Sets_tSet yyV3;
  72.                 Tree_tTree yyV4;
  73.                 SHORTCARD yyV5;
  74.                 Sets_tSet yyV6;
  75.             } yyR2;
  76.         } V_2;
  77.     } U_1;
  78. };
  79. struct S_6 {
  80.     union {
  81.         char dummy;
  82.     } U_1;
  83. };
  84. struct S_7 {
  85.     union {
  86.         char dummy;
  87.     } U_1;
  88. };
  89. static BOOLEAN NeedsMatch2 ARGS((Tree_tTree yyP4, Tree_tTree yyP3));
  90. struct S_8 {
  91.     union {
  92.         char dummy;
  93.     } U_1;
  94. };
  95. struct S_9 {
  96.     union {
  97.         struct {
  98.             struct S_10 {
  99.                 Tree_tTree yyV1;
  100.             } yyR1;
  101.         } V_1;
  102.     } U_1;
  103. };
  104. struct S_11 {
  105.     union {
  106.         char dummy;
  107.     } U_1;
  108. };
  109. struct S_12 {
  110.     union {
  111.         struct {
  112.             struct S_13 {
  113.                 Tree_tTree yyV1;
  114.             } yyR1;
  115.         } V_1;
  116.     } U_1;
  117. };
  118. static void CollectTests ARGS((Tree_tTree yyP11, Tree_tTree yyP10));
  119. struct S_14 {
  120.     union {
  121.         struct {
  122.             struct S_15 {
  123.                 Tree_tTree yyV1;
  124.             } yyR1;
  125.         } V_1;
  126.     } U_1;
  127. };
  128. static void CollectTests2 ARGS((Tree_tTree yyP14, Tree_tTree yyP13, Tree_tTree yyP12, Tree_tTree *yyP15));
  129. struct S_16 {
  130.     union {
  131.         struct {
  132.             struct S_20 {
  133.                 Tree_tTree yyV1;
  134.                 Tree_tTree yyV2;
  135.             } yyR1;
  136.         } V_1;
  137.         struct {
  138.             struct S_19 {
  139.                 Tree_tTree yyV1;
  140.             } yyR2;
  141.         } V_2;
  142.         struct {
  143.             struct S_18 {
  144.                 Tree_tTree yyV1;
  145.             } yyR3;
  146.         } V_3;
  147.         struct {
  148.             struct S_17 {
  149.                 Tree_tTree yyV1;
  150.             } yyR4;
  151.         } V_4;
  152.     } U_1;
  153. };
  154. static BOOLEAN IsSamePath ARGS((Tree_tTree yyP17, Tree_tTree yyP16));
  155. struct S_21 {
  156.     union {
  157.         char dummy;
  158.     } U_1;
  159. };
  160. static BOOLEAN IsSameType ARGS((Tree_tTree yyP19, Tree_tTree yyP18));
  161. struct S_22 {
  162.     union {
  163.         char dummy;
  164.     } U_1;
  165. };
  166. static BOOLEAN IsSameTest ARGS((Tree_tTree yyP21, Tree_tTree yyP20));
  167. struct S_23 {
  168.     union {
  169.         char dummy;
  170.     } U_1;
  171. };
  172. static void BuildTree ARGS((Tree_tTree yyP23, Tree_tTree yyP22, Tree_tTree *yyP24));
  173. struct S_24 {
  174.     union {
  175.         struct {
  176.             struct S_25 {
  177.                 Tree_tTree yyV1;
  178.                 Tree_tTree yyV2;
  179.             } yyR1;
  180.         } V_1;
  181.     } U_1;
  182. };
  183. static void BuildTree2 ARGS((Tree_tTree t, Tree_tTree d, Tree_tTree *yyP25));
  184. struct S_26 {
  185.     union {
  186.         struct {
  187.             struct S_32 {
  188.                 Tree_tTree yyV1;
  189.             } yyR1;
  190.         } V_1;
  191.         struct {
  192.             struct S_31 {
  193.                 Tree_tTree yyV1;
  194.             } yyR2;
  195.         } V_2;
  196.         struct {
  197.             struct S_30 {
  198.                 Tree_tTree yyV1;
  199.             } yyR3;
  200.         } V_3;
  201.         struct {
  202.             struct S_29 {
  203.                 Tree_tTree yyV1;
  204.             } yyR4;
  205.         } V_4;
  206.         struct {
  207.             struct S_28 {
  208.                 Tree_tTree yyV1;
  209.             } yyR6;
  210.         } V_5;
  211.         struct {
  212.             struct S_27 {
  213.                 Tree_tTree yyV1;
  214.             } yyR7;
  215.         } V_6;
  216.     } U_1;
  217. };
  218. static BOOLEAN HasInterference ARGS((Tree_tTree yyP27, Tree_tTree yyP26));
  219. struct S_33 {
  220.     union {
  221.         char dummy;
  222.     } U_1;
  223. };
  224. static void UpdateChange ARGS((Tree_tTree yyP29, Tree_tTree yyP28));
  225. struct S_34 {
  226.     union {
  227.         char dummy;
  228.     } U_1;
  229. };
  230. static BOOLEAN IsChanged ARGS((Tree_tTree yyP31, Tree_tTree yyP30));
  231. struct S_35 {
  232.     union {
  233.         char dummy;
  234.     } U_1;
  235. };
  236. static void FindCases ARGS((Tree_tTree yyP32, Tree_tTree *yyP35, SHORTCARD *yyP34, Sets_tSet *yyP33));
  237. struct S_36 {
  238.     union {
  239.         struct {
  240.             struct S_40 {
  241.                 Tree_tTree yyV1;
  242.                 SHORTCARD yyV2;
  243.                 Sets_tSet yyV3;
  244.                 Tree_tTree yyV4;
  245.                 SHORTCARD yyV5;
  246.                 Sets_tSet yyV6;
  247.                 SHORTCARD k;
  248.                 Sets_tSet s;
  249.             } yyR1;
  250.         } V_1;
  251.         struct {
  252.             struct S_39 {
  253.                 Tree_tTree yyV1;
  254.                 SHORTCARD yyV2;
  255.                 Sets_tSet yyV3;
  256.                 Tree_tTree yyV4;
  257.                 SHORTCARD yyV5;
  258.                 Sets_tSet yyV6;
  259.                 SHORTCARD k;
  260.                 Sets_tSet s;
  261.             } yyR2;
  262.         } V_2;
  263.         struct {
  264.             struct S_38 {
  265.                 Tree_tTree yyV1;
  266.                 SHORTCARD yyV2;
  267.                 Sets_tSet yyV3;
  268.                 Tree_tTree yyV4;
  269.                 SHORTCARD yyV5;
  270.                 Sets_tSet yyV6;
  271.             } yyR3;
  272.         } V_3;
  273.         struct {
  274.             struct S_37 {
  275.                 Tree_tTree yyV1;
  276.                 SHORTCARD yyV2;
  277.                 Sets_tSet yyV3;
  278.             } yyR4;
  279.         } V_4;
  280.     } U_1;
  281. };
  282. static void MarkCases ARGS((Tree_tTree yyP38, SHORTCARD yyP37, Sets_tSet yyP36));
  283. struct S_41 {
  284.     union {
  285.         char dummy;
  286.     } U_1;
  287. };
  288. static void ElimDeadTests ARGS((Tree_tTree yyP42, Tree_tTree yyP41, BOOLEAN yyP40, Sets_tSet yyP39));
  289. struct S_42 {
  290.     union {
  291.         struct {
  292.             struct S_48 {
  293.                 Sets_tSet s;
  294.                 Tree_tTree yyV1;
  295.                 Sets_tSet yyV2;
  296.             } yyR1;
  297.         } V_1;
  298.         struct {
  299.             struct S_47 {
  300.                 Sets_tSet s;
  301.                 Tree_tTree yyV1;
  302.                 Sets_tSet yyV2;
  303.             } yyR2;
  304.         } V_2;
  305.         struct {
  306.             struct S_46 {
  307.                 Sets_tSet types;
  308.                 Sets_tSet s2;
  309.                 Tree_tTree yyV1;
  310.                 Sets_tSet yyV2;
  311.             } yyR3;
  312.         } V_3;
  313.         struct {
  314.             struct S_45 {
  315.                 Sets_tSet types;
  316.                 Sets_tSet s2;
  317.                 Tree_tTree yyV1;
  318.                 Sets_tSet yyV2;
  319.             } yyR4;
  320.         } V_4;
  321.         struct {
  322.             struct S_44 {
  323.                 Tree_tTree yyV1;
  324.                 Sets_tSet yyV2;
  325.                 Tree_tTree yyV3;
  326.                 Sets_tSet yyV4;
  327.             } yyR5;
  328.         } V_5;
  329.         struct {
  330.             struct S_43 {
  331.                 Tree_tTree yyV1;
  332.                 Sets_tSet yyV2;
  333.             } yyR6;
  334.         } V_6;
  335.     } U_1;
  336. };
  337. static BOOLEAN IsDeadEnd ARGS((Tree_tTree yyP43));
  338. struct S_49 {
  339.     union {
  340.         char dummy;
  341.     } U_1;
  342. };
  343. static void ReportWarning ARGS((Tree_tTree yyP44));
  344. struct S_50 {
  345.     union {
  346.         char dummy;
  347.     } U_1;
  348. };
  349. static void yyExit ARGS(());
  350.  
  351.  
  352. static BOOLEAN IsDisjoint
  353. # ifdef __STDC__
  354. (Sets_tSet s1, Sets_tSet s2)
  355. # else
  356. (s1, s2)
  357. Sets_tSet s1, s2;
  358. # endif
  359. {
  360.   Sets_tSet s;
  361.   BOOLEAN Result;
  362.  
  363.   Sets_MakeSet(&s, Sets_Size(&s1));
  364.   Sets_Assign(&s, s1);
  365.   Sets_Intersection(&s, s2);
  366.   Result = Sets_IsEmpty(s);
  367.   Sets_ReleaseSet(&s);
  368.   return Result;
  369. }
  370.  
  371. static void yyAbort
  372. # ifdef __STDC__
  373. (CHAR yyFunction[], LONGCARD O_1)
  374. # else
  375. (yyFunction, O_1)
  376. CHAR yyFunction[];
  377. LONGCARD O_1;
  378. # endif
  379. {
  380.   OPEN_ARRAY_LOCALS
  381.  
  382.   ALLOC_OPEN_ARRAYS(O_1 * sizeof(CHAR), 1)
  383.   COPY_OPEN_ARRAY(yyFunction, O_1, CHAR)
  384.   IO_WriteS((System_tFile)IO_StdError, (STRING)"Error: module Optimize, routine ", 32L);
  385.   IO_WriteS((System_tFile)IO_StdError, yyFunction, O_1);
  386.   IO_WriteS((System_tFile)IO_StdError, (STRING)" failed", 7L);
  387.   IO_WriteNl((System_tFile)IO_StdError);
  388.   (*Optimize_Exit)();
  389.   FREE_OPEN_ARRAYS
  390. }
  391.  
  392. static BOOLEAN yyIsEqual
  393. # ifdef __STDC__
  394. (BYTE yya[], LONGCARD O_3, BYTE yyb[], LONGCARD O_2)
  395. # else
  396. (yya, O_3, yyb, O_2)
  397. BYTE yya[];
  398. LONGCARD O_3;
  399. BYTE yyb[];
  400. LONGCARD O_2;
  401. # endif
  402. {
  403.   INTEGER yyi;
  404.   OPEN_ARRAY_LOCALS
  405.  
  406.   ALLOC_OPEN_ARRAYS(O_2 * sizeof(WORD) + O_3 * sizeof(WORD), 2)
  407.   COPY_OPEN_ARRAY(yyb, O_2, WORD)
  408.   COPY_OPEN_ARRAY(yya, O_3, WORD)
  409.   {
  410.     LONGINT B_1 = 0, B_2 = (INTEGER)(O_3 - 1);
  411.  
  412.     if (B_1 <= B_2)
  413.       for (yyi = B_1;; yyi += 1) {
  414.         if (yya[yyi] != yyb[yyi]) {
  415.           FREE_OPEN_ARRAYS
  416.           return FALSE;
  417.         }
  418.         if (yyi >= B_2) break;
  419.       }
  420.   }
  421.   FREE_OPEN_ARRAYS
  422.   return TRUE;
  423. }
  424.  
  425. void Optimize_Optimize
  426. # ifdef __STDC__
  427. (Tree_tTree t)
  428. # else
  429. (t)
  430. Tree_tTree t;
  431. # endif
  432. {
  433.   struct S_3 yyTempo;
  434.  
  435.   if (t->U_1.V_1.Kind == Tree_Spec) {
  436.     {
  437.       register struct S_5 *W_1 = &yyTempo.U_1.V_1.yyR1;
  438.  
  439.       {
  440.         register Tree_ySpec *W_2 = &t->U_1.V_26.Spec;
  441.  
  442.         W_1->yyV1 = (Tree_tTree)Tree_yyPoolFreePtr;
  443.         if ((ADDRESS)W_1->yyV1 >= Tree_yyPoolMaxPtr) {
  444.           W_1->yyV1 = Tree_yyAlloc();
  445.         }
  446.         INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_NoDecision]);
  447.         W_1->yyV1->U_1.V_2.yyHead.yyMark = 0;
  448.         W_1->yyV1->U_1.V_1.Kind = Tree_NoDecision;
  449.         nNoDecision = W_1->yyV1;
  450.         W_1->yyV2 = (Tree_tTree)Tree_yyPoolFreePtr;
  451.         if ((ADDRESS)W_1->yyV2 >= Tree_yyPoolMaxPtr) {
  452.           W_1->yyV2 = Tree_yyAlloc();
  453.         }
  454.         INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_NoTest]);
  455.         W_1->yyV2->U_1.V_2.yyHead.yyMark = 0;
  456.         W_1->yyV2->U_1.V_1.Kind = Tree_NoTest;
  457.         nNoTest = W_1->yyV2;
  458.         Optimize_Optimize(W_2->Routines);
  459.         return;
  460.       }
  461.     }
  462.   }
  463.   if (Tree_IsType(t, Tree_Routine)) {
  464.     {
  465.       register struct S_4 *W_3 = &yyTempo.U_1.V_2.yyR2;
  466.  
  467.       {
  468.         register Tree_yRoutine *W_4 = &t->U_1.V_32.Routine;
  469.  
  470.         Optimize_RuleProperties(W_4->Rules);
  471.         CollectTests(W_4->Rules, W_4->InForm);
  472.         BuildTree(W_4->Rules, nNoDecision, &W_3->yyV1);
  473.         W_4->Decisions = W_3->yyV1;
  474.         ElimDeadTests(W_4->Decisions, W_3->yyV2, FALSE, W_3->yyV3);
  475.         FindCases(W_4->Decisions, &W_3->yyV4, &W_3->yyV5, &W_3->yyV6);
  476.         MarkCases(W_4->Decisions, W_3->yyV5, W_3->yyV6);
  477.         Optimize_Optimize(W_4->Next);
  478.         return;
  479.       }
  480.     }
  481.   }
  482. }
  483.  
  484. void Optimize_RuleProperties
  485. # ifdef __STDC__
  486. (Tree_tTree yyP1)
  487. # else
  488. (yyP1)
  489. Tree_tTree yyP1;
  490. # endif
  491. {
  492.   struct S_6 yyTempo;
  493.  
  494.   switch (yyP1->U_1.V_1.Kind) {
  495.   case Tree_Spec:;
  496.     {
  497.       register Tree_ySpec *W_5 = &yyP1->U_1.V_26.Spec;
  498.  
  499.       Optimize_RuleProperties(W_5->Routines);
  500.       return;
  501.     }
  502.     break;
  503.   case Tree_Routine:;
  504.   case Tree_Procedure:;
  505.   case Tree_Function:;
  506.   case Tree_Predicate:;
  507.     {
  508.       register Tree_yRoutine *W_6 = &yyP1->U_1.V_32.Routine;
  509.  
  510.       Optimize_RuleProperties(W_6->Rules);
  511.       Optimize_RuleProperties(W_6->Next);
  512.       return;
  513.     }
  514.     break;
  515.   case Tree_Rule:;
  516.     {
  517.       register Tree_yRule *W_7 = &yyP1->U_1.V_42.Rule;
  518.  
  519.       gHasExit = FALSE;
  520.       gHasAssign = FALSE;
  521.       gHasTargetCode = FALSE;
  522.       gHasRejectOrFail = FALSE;
  523.       Optimize_RuleProperties(W_7->Statements);
  524.       Optimize_RuleProperties(W_7->Exprs);
  525.       Optimize_RuleProperties(W_7->Expr);
  526.       W_7->HasExit = gHasExit;
  527.       W_7->HasAssign = gHasAssign;
  528.       W_7->HasTargetCode = gHasTargetCode;
  529.       W_7->HasRejectOrFail = gHasRejectOrFail;
  530.       Optimize_RuleProperties(W_7->Next);
  531.       return;
  532.     }
  533.     break;
  534.   case Tree_ProcCall:;
  535.     {
  536.       register Tree_yProcCall *W_8 = &yyP1->U_1.V_76.ProcCall;
  537.  
  538.       Optimize_RuleProperties(W_8->Call);
  539.       Optimize_RuleProperties(W_8->Next);
  540.       return;
  541.     }
  542.     break;
  543.   case Tree_Assignment:;
  544.     {
  545.       register Tree_yAssignment *W_9 = &yyP1->U_1.V_78.Assignment;
  546.  
  547.       gHasAssign = TRUE;
  548.       Optimize_RuleProperties(W_9->Adr);
  549.       Optimize_RuleProperties(W_9->Expr);
  550.       Optimize_RuleProperties(W_9->Next);
  551.       return;
  552.     }
  553.     break;
  554.   case Tree_Condition:;
  555.     {
  556.       register Tree_yCondition *W_10 = &yyP1->U_1.V_77.Condition;
  557.  
  558.       gHasExit = TRUE;
  559.       Optimize_RuleProperties(W_10->Next);
  560.       return;
  561.     }
  562.     break;
  563.   case Tree_Reject:;
  564.     {
  565.       register Tree_yReject *W_11 = &yyP1->U_1.V_79.Reject;
  566.  
  567.       gHasExit = TRUE;
  568.       gHasRejectOrFail = TRUE;
  569.       Optimize_RuleProperties(W_11->Next);
  570.       return;
  571.     }
  572.     break;
  573.   case Tree_Fail:;
  574.     {
  575.       register Tree_yFail *W_12 = &yyP1->U_1.V_80.Fail;
  576.  
  577.       gHasRejectOrFail = TRUE;
  578.       Optimize_RuleProperties(W_12->Next);
  579.       return;
  580.     }
  581.     break;
  582.   case Tree_TargetStmt:;
  583.     {
  584.       register Tree_yTargetStmt *W_13 = &yyP1->U_1.V_81.TargetStmt;
  585.  
  586.       gHasTargetCode = TRUE;
  587.       Optimize_RuleProperties(W_13->Next);
  588.       return;
  589.     }
  590.     break;
  591.   case Tree_Statement:;
  592.   case Tree_Nl:;
  593.   case Tree_WriteStr:;
  594.     {
  595.       register Tree_yStatement *W_14 = &yyP1->U_1.V_75.Statement;
  596.  
  597.       Optimize_RuleProperties(W_14->Next);
  598.       return;
  599.     }
  600.     break;
  601.   case Tree_OneExpr:;
  602.   case Tree_NamedExpr:;
  603.     {
  604.       register Tree_yOneExpr *W_15 = &yyP1->U_1.V_58.OneExpr;
  605.  
  606.       Optimize_RuleProperties(W_15->Expr);
  607.       Optimize_RuleProperties(W_15->Next);
  608.       return;
  609.     }
  610.     break;
  611.   case Tree_Expr:;
  612.   case Tree_Compose:;
  613.   case Tree_VarUse:;
  614.   case Tree_AttrDesc:;
  615.   case Tree_Nil:;
  616.   case Tree_Call:;
  617.   case Tree_Binary:;
  618.   case Tree_PreOperator:;
  619.   case Tree_PostOperator:;
  620.   case Tree_Index:;
  621.   case Tree_Parents:;
  622.   case Tree_TargetExpr:;
  623.   case Tree_StringExpr:;
  624.     {
  625.       register Tree_yExpr *W_16 = &yyP1->U_1.V_60.Expr;
  626.  
  627.       gHasExit = gHasExit || Optimize_NeedsMatch(yyP1);
  628.       return;
  629.     }
  630.     break;
  631.   default :
  632.     break;
  633.   }
  634. }
  635.  
  636. BOOLEAN Optimize_NeedsMatch
  637. # ifdef __STDC__
  638. (Tree_tTree yyP2)
  639. # else
  640. (yyP2)
  641. Tree_tTree yyP2;
  642. # endif
  643. {
  644.   struct S_7 yyTempo;
  645.  
  646.   if (yyP2->U_1.V_1.Kind == Tree_TestValue) {
  647.     for (;;) {
  648.       {
  649.         register Tree_yTestValue *W_17 = &yyP2->U_1.V_102.TestValue;
  650.  
  651.         if (!(Optimize_NeedsMatch(W_17->Expr) || Optimize_NeedsMatch(W_17->Next))) {
  652.           goto EXIT_1;
  653.         }
  654.         return TRUE;
  655.       }
  656.     } EXIT_1:;
  657.   }
  658.   switch (yyP2->U_1.V_1.Kind) {
  659.   case Tree_OneTest:;
  660.   case Tree_TestKind:;
  661.   case Tree_TestIsType:;
  662.   case Tree_TestNil:;
  663.   case Tree_TestNonlin:;
  664.   case Tree_TestValue:;
  665.     for (;;) {
  666.       {
  667.         register Tree_yOneTest *W_18 = &yyP2->U_1.V_97.OneTest;
  668.  
  669.         if (!Optimize_NeedsMatch(W_18->Next)) {
  670.           goto EXIT_2;
  671.         }
  672.         return TRUE;
  673.       }
  674.     } EXIT_2:;
  675.     break;
  676.   case Tree_OneExpr:;
  677.   case Tree_NamedExpr:;
  678.     for (;;) {
  679.       {
  680.         register Tree_yOneExpr *W_19 = &yyP2->U_1.V_58.OneExpr;
  681.  
  682.         if (!(Optimize_NeedsMatch(W_19->Expr) || Optimize_NeedsMatch(W_19->Next))) {
  683.           goto EXIT_3;
  684.         }
  685.         return TRUE;
  686.       }
  687.     } EXIT_3:;
  688.     break;
  689.   case Tree_Compose:;
  690.     for (;;) {
  691.       {
  692.         register Tree_yCompose *W_20 = &yyP2->U_1.V_61.Compose;
  693.  
  694.         if (!Optimize_NeedsMatch(W_20->Exprs)) {
  695.           goto EXIT_4;
  696.         }
  697.         return TRUE;
  698.       }
  699.     } EXIT_4:;
  700.     break;
  701.   case Tree_Call:;
  702.     for (;;) {
  703.       {
  704.         register Tree_yCall *W_21 = &yyP2->U_1.V_65.Call;
  705.  
  706.         if (!(Optimize_NeedsMatch(W_21->Expr) || Optimize_NeedsMatch(W_21->Exprs) || W_21->Object != Tree_NoTree && NeedsMatch2(W_21->Patterns, W_21->Object->U_1.V_32.Routine.OutForm))) {
  707.           goto EXIT_5;
  708.         }
  709.         return TRUE;
  710.       }
  711.     } EXIT_5:;
  712.     break;
  713.   case Tree_Binary:;
  714.     for (;;) {
  715.       {
  716.         register Tree_yBinary *W_22 = &yyP2->U_1.V_66.Binary;
  717.  
  718.         if (!(Optimize_NeedsMatch(W_22->Lop) || Optimize_NeedsMatch(W_22->Rop))) {
  719.           goto EXIT_6;
  720.         }
  721.         return TRUE;
  722.       }
  723.     } EXIT_6:;
  724.     break;
  725.   case Tree_Parents:;
  726.     for (;;) {
  727.       {
  728.         register Tree_yParents *W_23 = &yyP2->U_1.V_70.Parents;
  729.  
  730.         if (!Optimize_NeedsMatch(W_23->Expr)) {
  731.           goto EXIT_7;
  732.         }
  733.         return TRUE;
  734.       }
  735.     } EXIT_7:;
  736.     break;
  737.   case Tree_PreOperator:;
  738.     for (;;) {
  739.       {
  740.         register Tree_yPreOperator *W_24 = &yyP2->U_1.V_67.PreOperator;
  741.  
  742.         if (!Optimize_NeedsMatch(W_24->Expr)) {
  743.           goto EXIT_8;
  744.         }
  745.         return TRUE;
  746.       }
  747.     } EXIT_8:;
  748.     break;
  749.   case Tree_PostOperator:;
  750.     for (;;) {
  751.       {
  752.         register Tree_yPostOperator *W_25 = &yyP2->U_1.V_68.PostOperator;
  753.  
  754.         if (!Optimize_NeedsMatch(W_25->Expr)) {
  755.           goto EXIT_9;
  756.         }
  757.         return TRUE;
  758.       }
  759.     } EXIT_9:;
  760.     break;
  761.   case Tree_Index:;
  762.     for (;;) {
  763.       {
  764.         register Tree_yIndex *W_26 = &yyP2->U_1.V_69.Index;
  765.  
  766.         if (!(Optimize_NeedsMatch(W_26->Expr) || Optimize_NeedsMatch(W_26->Exprs))) {
  767.           goto EXIT_10;
  768.         }
  769.         return TRUE;
  770.       }
  771.     } EXIT_10:;
  772.     break;
  773.   default :
  774.     break;
  775.   }
  776.   return FALSE;
  777. }
  778.  
  779. static BOOLEAN NeedsMatch2
  780. # ifdef __STDC__
  781. (Tree_tTree yyP4, Tree_tTree yyP3)
  782. # else
  783. (yyP4, yyP3)
  784. Tree_tTree yyP4;
  785. Tree_tTree yyP3;
  786. # endif
  787. {
  788.   struct S_8 yyTempo;
  789.  
  790.   if (yyP4->U_1.V_1.Kind == Tree_OnePattern) {
  791.     for (;;) {
  792.       {
  793.         register Tree_yOnePattern *W_27 = &yyP4->U_1.V_45.OnePattern;
  794.  
  795.         if (!(NeedsMatch2(W_27->Pattern, yyP3) || NeedsMatch2(W_27->Next, yyP3->U_1.V_86.Formal.Next))) {
  796.           goto EXIT_11;
  797.         }
  798.         return TRUE;
  799.       }
  800.     } EXIT_11:;
  801.   }
  802.   if (yyP4->U_1.V_1.Kind == Tree_Decompose) {
  803.     for (;;) {
  804.       {
  805.         register Tree_yDecompose *W_28 = &yyP4->U_1.V_50.Decompose;
  806.  
  807.         {
  808.           register Tree_yFormal *W_29 = &yyP3->U_1.V_86.Formal;
  809.  
  810.           if (!(yyP3->U_1.V_86.Formal.TypeDesc->U_1.V_1.Kind == Tree_UserType || Sets_IsNotEqual(W_28->Object->U_1.V_5.Class.TypeDesc->U_1.V_89.NodeTypes.Types, yyP3->U_1.V_86.Formal.TypeDesc->U_1.V_89.NodeTypes.Types) || NeedsMatch2(W_28->Patterns, W_28->Object->U_1.V_5.Class.Formals))) {
  811.             goto EXIT_12;
  812.           }
  813.           return TRUE;
  814.         }
  815.       }
  816.     } EXIT_12:;
  817.   }
  818.   if (yyP4->U_1.V_1.Kind == Tree_VarDef) {
  819.     for (;;) {
  820.       {
  821.         register Tree_yVarDef *W_30 = &yyP4->U_1.V_51.VarDef;
  822.  
  823.         if (!(W_30->Object != Tree_NoTree)) {
  824.           goto EXIT_13;
  825.         }
  826.         return TRUE;
  827.       }
  828.     } EXIT_13:;
  829.   }
  830.   if (yyP4->U_1.V_1.Kind == Tree_NilTest) {
  831.     return TRUE;
  832.   }
  833.   if (yyP4->U_1.V_1.Kind == Tree_Value) {
  834.     return TRUE;
  835.   }
  836.   return FALSE;
  837. }
  838.  
  839. BOOLEAN Optimize_NeedsTempo
  840. # ifdef __STDC__
  841. (Tree_tTree yyP5, Tree_tTree *yyP6)
  842. # else
  843. (yyP5, yyP6)
  844. Tree_tTree yyP5;
  845. Tree_tTree *yyP6;
  846. # endif
  847. {
  848.   struct S_9 yyTempo;
  849.  
  850.   if (yyP5->U_1.V_1.Kind == Tree_Decision) {
  851.     {
  852.       register struct S_10 *W_31 = &yyTempo.U_1.V_1.yyR1;
  853.  
  854.       for (;;) {
  855.         {
  856.           register Tree_yDecision *W_32 = &yyP5->U_1.V_105.Decision;
  857.  
  858.           if (!Optimize_NeedsTempo(yyP5->U_1.V_105.Decision.Then, &W_31->yyV1)) {
  859.             goto EXIT_14;
  860.           }
  861.           *yyP6 = W_31->yyV1;
  862.           return TRUE;
  863.         }
  864.       } EXIT_14:;
  865.     }
  866.   }
  867.   if (yyP5->U_1.V_1.Kind == Tree_Decided) {
  868.     if (yyP5->U_1.V_106.Decided.Rule->U_1.V_42.Rule.HasTempos == TRUE) {
  869.       *yyP6 = yyP5->U_1.V_106.Decided.Rule;
  870.       return TRUE;
  871.     }
  872.   }
  873.   return FALSE;
  874. }
  875.  
  876. BOOLEAN Optimize_NeedsNoFinale
  877. # ifdef __STDC__
  878. (Tree_tTree yyP7)
  879. # else
  880. (yyP7)
  881. Tree_tTree yyP7;
  882. # endif
  883. {
  884.   struct S_11 yyTempo;
  885.  
  886.   if (yyP7->U_1.V_1.Kind == Tree_Decision) {
  887.     for (;;) {
  888.       {
  889.         register Tree_yDecision *W_33 = &yyP7->U_1.V_105.Decision;
  890.  
  891.         if (!Optimize_NeedsNoFinale(yyP7->U_1.V_105.Decision.Else)) {
  892.           goto EXIT_15;
  893.         }
  894.         return TRUE;
  895.       }
  896.     } EXIT_15:;
  897.   }
  898.   if (yyP7->U_1.V_1.Kind == Tree_Decided) {
  899.     if (yyP7->U_1.V_106.Decided.Rule->U_1.V_42.Rule.HasExit == FALSE) {
  900.       return TRUE;
  901.     }
  902.     for (;;) {
  903.       {
  904.         register Tree_yDecided *W_34 = &yyP7->U_1.V_106.Decided;
  905.  
  906.         if (!Optimize_NeedsNoFinale(yyP7->U_1.V_106.Decided.Else)) {
  907.           goto EXIT_16;
  908.         }
  909.         return TRUE;
  910.       }
  911.     } EXIT_16:;
  912.   }
  913.   return FALSE;
  914. }
  915.  
  916. void Optimize_GetRule
  917. # ifdef __STDC__
  918. (Tree_tTree yyP8, Tree_tTree *yyP9)
  919. # else
  920. (yyP8, yyP9)
  921. Tree_tTree yyP8;
  922. Tree_tTree *yyP9;
  923. # endif
  924. {
  925.   struct S_12 yyTempo;
  926.  
  927.   if (yyP8->U_1.V_1.Kind == Tree_Decision) {
  928.     {
  929.       register struct S_13 *W_35 = &yyTempo.U_1.V_1.yyR1;
  930.  
  931.       {
  932.         register Tree_yDecision *W_36 = &yyP8->U_1.V_105.Decision;
  933.  
  934.         Optimize_GetRule(yyP8->U_1.V_105.Decision.Then, &W_35->yyV1);
  935.         *yyP9 = W_35->yyV1;
  936.         return;
  937.       }
  938.     }
  939.   }
  940.   if (yyP8->U_1.V_1.Kind == Tree_Decided) {
  941.     *yyP9 = yyP8->U_1.V_106.Decided.Rule;
  942.     return;
  943.   }
  944. }
  945.  
  946. static void CollectTests
  947. # ifdef __STDC__
  948. (Tree_tTree yyP11, Tree_tTree yyP10)
  949. # else
  950. (yyP11, yyP10)
  951. Tree_tTree yyP11;
  952. Tree_tTree yyP10;
  953. # endif
  954. {
  955.   struct S_14 yyTempo;
  956.  
  957.   if (yyP11->U_1.V_1.Kind == Tree_Rule) {
  958.     {
  959.       register struct S_15 *W_37 = &yyTempo.U_1.V_1.yyR1;
  960.  
  961.       {
  962.         register Tree_yRule *W_38 = &yyP11->U_1.V_42.Rule;
  963.  
  964.         CollectTests2(W_38->Patterns, yyP10, nNoTest, &W_37->yyV1);
  965.         W_38->Tests = W_37->yyV1;
  966.         CollectTests(W_38->Next, yyP10);
  967.         return;
  968.       }
  969.     }
  970.   }
  971. }
  972.  
  973. static void CollectTests2
  974. # ifdef __STDC__
  975. (Tree_tTree yyP14, Tree_tTree yyP13, Tree_tTree yyP12, Tree_tTree *yyP15)
  976. # else
  977. (yyP14, yyP13, yyP12, yyP15)
  978. Tree_tTree yyP14;
  979. Tree_tTree yyP13;
  980. Tree_tTree yyP12;
  981. Tree_tTree *yyP15;
  982. # endif
  983. {
  984.   struct S_16 yyTempo;
  985.  
  986.   if (yyP14->U_1.V_1.Kind == Tree_OnePattern) {
  987.     if (yyP13->U_1.V_1.Kind == Tree_Formal) {
  988.       {
  989.         register struct S_20 *W_39 = &yyTempo.U_1.V_1.yyR1;
  990.  
  991.         {
  992.           register Tree_yOnePattern *W_40 = &yyP14->U_1.V_45.OnePattern;
  993.  
  994.           {
  995.             register Tree_yFormal *W_41 = &yyP13->U_1.V_86.Formal;
  996.  
  997.             CollectTests2(yyP14->U_1.V_45.OnePattern.Next, yyP13->U_1.V_86.Formal.Next, yyP12, &W_39->yyV1);
  998.             CollectTests2(yyP14->U_1.V_45.OnePattern.Pattern, yyP13, W_39->yyV1, &W_39->yyV2);
  999.             *yyP15 = W_39->yyV2;
  1000.             return;
  1001.           }
  1002.         }
  1003.       }
  1004.     }
  1005.   }
  1006.   if (yyP14->U_1.V_1.Kind == Tree_Decompose) {
  1007.     if (yyP13->U_1.V_1.Kind == Tree_Formal) {
  1008.       {
  1009.         register struct S_19 *W_42 = &yyTempo.U_1.V_2.yyR2;
  1010.  
  1011.         for (;;) {
  1012.           {
  1013.             register Tree_yDecompose *W_43 = &yyP14->U_1.V_50.Decompose;
  1014.  
  1015.             {
  1016.               register Tree_yFormal *W_44 = &yyP13->U_1.V_86.Formal;
  1017.  
  1018.               if (!(yyP13->U_1.V_86.Formal.TypeDesc->U_1.V_1.Kind != Tree_UserType && Sets_IsEqual(&W_43->Object->U_1.V_5.Class.TypeDesc->U_1.V_89.NodeTypes.Types, &yyP13->U_1.V_86.Formal.TypeDesc->U_1.V_89.NodeTypes.Types))) {
  1019.                 goto EXIT_17;
  1020.               }
  1021.               CollectTests2(W_43->Patterns, W_43->Object->U_1.V_5.Class.Formals, yyP12, &W_42->yyV1);
  1022.               *yyP15 = W_42->yyV1;
  1023.               return;
  1024.             }
  1025.           }
  1026.         } EXIT_17:;
  1027.       }
  1028.       {
  1029.         register struct S_18 *W_45 = &yyTempo.U_1.V_3.yyR3;
  1030.  
  1031.         for (;;) {
  1032.           {
  1033.             register Tree_yDecompose *W_46 = &yyP14->U_1.V_50.Decompose;
  1034.  
  1035.             {
  1036.               register Tree_yFormal *W_47 = &yyP13->U_1.V_86.Formal;
  1037.  
  1038.               if (!(yyP14->U_1.V_50.Decompose.Object->U_1.V_5.Class.Extensions->U_1.V_1.Kind == Tree_NoClass)) {
  1039.                 goto EXIT_18;
  1040.               }
  1041.               CollectTests2(yyP14->U_1.V_50.Decompose.Patterns, yyP14->U_1.V_50.Decompose.Object->U_1.V_5.Class.Formals, yyP12, &W_45->yyV1);
  1042.               *yyP15 = (Tree_tTree)Tree_yyPoolFreePtr;
  1043.               if ((ADDRESS)(*yyP15) >= Tree_yyPoolMaxPtr) {
  1044.                 *yyP15 = Tree_yyAlloc();
  1045.               }
  1046.               INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_TestKind]);
  1047.               (*yyP15)->U_1.V_2.yyHead.yyMark = 0;
  1048.               (*yyP15)->U_1.V_1.Kind = Tree_TestKind;
  1049.               {
  1050.                 register Tree_yTestKind *W_48 = &(*yyP15)->U_1.V_98.TestKind;
  1051.  
  1052.                 W_48->Next = W_45->yyV1;
  1053.                 W_48->Path = yyP14->U_1.V_50.Decompose.Path;
  1054.                 W_48->TypeDesc = yyP14->U_1.V_50.Decompose.Object->U_1.V_5.Class.TypeDesc;
  1055.                 W_48->Name = yyP14->U_1.V_50.Decompose.Object->U_1.V_5.Class.Name;
  1056.               }
  1057.               return;
  1058.             }
  1059.           }
  1060.         } EXIT_18:;
  1061.       }
  1062.     }
  1063.     {
  1064.       register struct S_17 *W_49 = &yyTempo.U_1.V_4.yyR4;
  1065.  
  1066.       {
  1067.         register Tree_yDecompose *W_50 = &yyP14->U_1.V_50.Decompose;
  1068.  
  1069.         CollectTests2(yyP14->U_1.V_50.Decompose.Patterns, yyP14->U_1.V_50.Decompose.Object->U_1.V_5.Class.Formals, yyP12, &W_49->yyV1);
  1070.         *yyP15 = (Tree_tTree)Tree_yyPoolFreePtr;
  1071.         if ((ADDRESS)(*yyP15) >= Tree_yyPoolMaxPtr) {
  1072.           *yyP15 = Tree_yyAlloc();
  1073.         }
  1074.         INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_TestIsType]);
  1075.         (*yyP15)->U_1.V_2.yyHead.yyMark = 0;
  1076.         (*yyP15)->U_1.V_1.Kind = Tree_TestIsType;
  1077.         {
  1078.           register Tree_yTestIsType *W_51 = &(*yyP15)->U_1.V_99.TestIsType;
  1079.  
  1080.           W_51->Next = W_49->yyV1;
  1081.           W_51->Path = yyP14->U_1.V_50.Decompose.Path;
  1082.           W_51->TypeDesc = yyP14->U_1.V_50.Decompose.Object->U_1.V_5.Class.TypeDesc;
  1083.           W_51->Name = yyP14->U_1.V_50.Decompose.Object->U_1.V_5.Class.Name;
  1084.         }
  1085.         return;
  1086.       }
  1087.     }
  1088.   }
  1089.   if (yyP14->U_1.V_1.Kind == Tree_VarDef) {
  1090.     for (;;) {
  1091.       {
  1092.         register Tree_yVarDef *W_52 = &yyP14->U_1.V_51.VarDef;
  1093.  
  1094.         if (!(W_52->Object != Tree_NoTree)) {
  1095.           goto EXIT_19;
  1096.         }
  1097.         *yyP15 = (Tree_tTree)Tree_yyPoolFreePtr;
  1098.         if ((ADDRESS)(*yyP15) >= Tree_yyPoolMaxPtr) {
  1099.           *yyP15 = Tree_yyAlloc();
  1100.         }
  1101.         INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_TestNonlin]);
  1102.         (*yyP15)->U_1.V_2.yyHead.yyMark = 0;
  1103.         (*yyP15)->U_1.V_1.Kind = Tree_TestNonlin;
  1104.         {
  1105.           register Tree_yTestNonlin *W_53 = &(*yyP15)->U_1.V_101.TestNonlin;
  1106.  
  1107.           W_53->Next = yyP12;
  1108.           W_53->Path = W_52->Object->U_1.V_86.Formal.Path;
  1109.           W_53->Path2 = yyP14->U_1.V_51.VarDef.Path;
  1110.           W_53->TypeDesc = W_52->Object->U_1.V_86.Formal.TypeDesc;
  1111.         }
  1112.         return;
  1113.       }
  1114.     } EXIT_19:;
  1115.   }
  1116.   if (yyP14->U_1.V_1.Kind == Tree_NilTest) {
  1117.     *yyP15 = (Tree_tTree)Tree_yyPoolFreePtr;
  1118.     if ((ADDRESS)(*yyP15) >= Tree_yyPoolMaxPtr) {
  1119.       *yyP15 = Tree_yyAlloc();
  1120.     }
  1121.     INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_TestNil]);
  1122.     (*yyP15)->U_1.V_2.yyHead.yyMark = 0;
  1123.     (*yyP15)->U_1.V_1.Kind = Tree_TestNil;
  1124.     {
  1125.       register Tree_yTestNil *W_54 = &(*yyP15)->U_1.V_100.TestNil;
  1126.  
  1127.       W_54->Next = yyP12;
  1128.       W_54->Path = yyP14->U_1.V_52.NilTest.Path;
  1129.     }
  1130.     return;
  1131.   }
  1132.   if (yyP14->U_1.V_1.Kind == Tree_Value) {
  1133.     if (yyP13->U_1.V_1.Kind == Tree_Formal) {
  1134.       *yyP15 = (Tree_tTree)Tree_yyPoolFreePtr;
  1135.       if ((ADDRESS)(*yyP15) >= Tree_yyPoolMaxPtr) {
  1136.         *yyP15 = Tree_yyAlloc();
  1137.       }
  1138.       INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_TestValue]);
  1139.       (*yyP15)->U_1.V_2.yyHead.yyMark = 0;
  1140.       (*yyP15)->U_1.V_1.Kind = Tree_TestValue;
  1141.       {
  1142.         register Tree_yTestValue *W_55 = &(*yyP15)->U_1.V_102.TestValue;
  1143.  
  1144.         W_55->Next = yyP12;
  1145.         W_55->Path = yyP14->U_1.V_55.Value.Path;
  1146.         W_55->Expr = yyP14->U_1.V_55.Value.Expr;
  1147.         W_55->TypeDesc = yyP13->U_1.V_86.Formal.TypeDesc;
  1148.       }
  1149.       return;
  1150.     }
  1151.   }
  1152.   *yyP15 = yyP12;
  1153.   return;
  1154. }
  1155.  
  1156. static BOOLEAN IsSamePath
  1157. # ifdef __STDC__
  1158. (Tree_tTree yyP17, Tree_tTree yyP16)
  1159. # else
  1160. (yyP17, yyP16)
  1161. Tree_tTree yyP17;
  1162. Tree_tTree yyP16;
  1163. # endif
  1164. {
  1165.   struct S_21 yyTempo;
  1166.  
  1167.   if (yyP17->U_1.V_1.Kind == Tree_Var) {
  1168.     if (yyP16->U_1.V_1.Kind == Tree_Var) {
  1169.       if (yyP17->U_1.V_92.Var.Name == yyP16->U_1.V_92.Var.Name) {
  1170.         return TRUE;
  1171.       }
  1172.     }
  1173.   }
  1174.   if (yyP17->U_1.V_1.Kind == Tree_ConsType) {
  1175.     if (yyP16->U_1.V_1.Kind == Tree_ConsType) {
  1176.       if (yyP17->U_1.V_93.ConsType.Name == yyP16->U_1.V_93.ConsType.Name) {
  1177.         for (;;) {
  1178.           {
  1179.             register Tree_yConsType *W_56 = &yyP17->U_1.V_93.ConsType;
  1180.  
  1181.             {
  1182.               register Tree_yConsType *W_57 = &yyP16->U_1.V_93.ConsType;
  1183.  
  1184.               if (!IsSamePath(yyP17->U_1.V_93.ConsType.Next, yyP16->U_1.V_93.ConsType.Next)) {
  1185.                 goto EXIT_20;
  1186.               }
  1187.               return TRUE;
  1188.             }
  1189.           }
  1190.         } EXIT_20:;
  1191.       }
  1192.     }
  1193.   }
  1194.   if (yyP17->U_1.V_1.Kind == Tree_Field) {
  1195.     if (yyP16->U_1.V_1.Kind == Tree_Field) {
  1196.       if (yyP17->U_1.V_94.Field.Name == yyP16->U_1.V_94.Field.Name) {
  1197.         for (;;) {
  1198.           {
  1199.             register Tree_yField *W_58 = &yyP17->U_1.V_94.Field;
  1200.  
  1201.             {
  1202.               register Tree_yField *W_59 = &yyP16->U_1.V_94.Field;
  1203.  
  1204.               if (!IsSamePath(yyP17->U_1.V_94.Field.Next, yyP16->U_1.V_94.Field.Next)) {
  1205.                 goto EXIT_21;
  1206.               }
  1207.               return TRUE;
  1208.             }
  1209.           }
  1210.         } EXIT_21:;
  1211.       }
  1212.     }
  1213.   }
  1214.   return FALSE;
  1215. }
  1216.  
  1217. static BOOLEAN IsSameType
  1218. # ifdef __STDC__
  1219. (Tree_tTree yyP19, Tree_tTree yyP18)
  1220. # else
  1221. (yyP19, yyP18)
  1222. Tree_tTree yyP19;
  1223. Tree_tTree yyP18;
  1224. # endif
  1225. {
  1226.   struct S_22 yyTempo;
  1227.  
  1228.   if (yyP19->U_1.V_1.Kind == Tree_NodeTypes) {
  1229.     if (yyP18->U_1.V_1.Kind == Tree_NodeTypes) {
  1230.       if (yyP19->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.Name == yyP18->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.Name) {
  1231.         if (Sets_IsEqual(&yyP19->U_1.V_89.NodeTypes.Types, &yyP18->U_1.V_89.NodeTypes.Types)) {
  1232.           return TRUE;
  1233.         }
  1234.       }
  1235.     }
  1236.   }
  1237.   if (yyP19->U_1.V_1.Kind == Tree_UserType) {
  1238.     if (yyP18->U_1.V_1.Kind == Tree_UserType) {
  1239.       if (yyP19->U_1.V_90.UserType.Type == yyP18->U_1.V_90.UserType.Type) {
  1240.         return TRUE;
  1241.       }
  1242.     }
  1243.   }
  1244.   return FALSE;
  1245. }
  1246.  
  1247. static BOOLEAN IsSameTest
  1248. # ifdef __STDC__
  1249. (Tree_tTree yyP21, Tree_tTree yyP20)
  1250. # else
  1251. (yyP21, yyP20)
  1252. Tree_tTree yyP21;
  1253. Tree_tTree yyP20;
  1254. # endif
  1255. {
  1256.   struct S_23 yyTempo;
  1257.  
  1258.   if (yyP21->U_1.V_1.Kind == Tree_TestKind) {
  1259.     if (yyP20->U_1.V_1.Kind == Tree_TestKind) {
  1260.       for (;;) {
  1261.         {
  1262.           register Tree_yTestKind *W_60 = &yyP21->U_1.V_98.TestKind;
  1263.  
  1264.           {
  1265.             register Tree_yTestKind *W_61 = &yyP20->U_1.V_98.TestKind;
  1266.  
  1267.             if (!IsSamePath(yyP21->U_1.V_98.TestKind.Path, yyP20->U_1.V_98.TestKind.Path)) {
  1268.               goto EXIT_22;
  1269.             }
  1270.             if (!IsSameType(yyP21->U_1.V_98.TestKind.TypeDesc, yyP20->U_1.V_98.TestKind.TypeDesc)) {
  1271.               goto EXIT_22;
  1272.             }
  1273.             return TRUE;
  1274.           }
  1275.         }
  1276.       } EXIT_22:;
  1277.     }
  1278.   }
  1279.   if (yyP21->U_1.V_1.Kind == Tree_TestIsType) {
  1280.     if (yyP20->U_1.V_1.Kind == Tree_TestIsType) {
  1281.       for (;;) {
  1282.         {
  1283.           register Tree_yTestIsType *W_62 = &yyP21->U_1.V_99.TestIsType;
  1284.  
  1285.           {
  1286.             register Tree_yTestIsType *W_63 = &yyP20->U_1.V_99.TestIsType;
  1287.  
  1288.             if (!IsSamePath(yyP21->U_1.V_99.TestIsType.Path, yyP20->U_1.V_99.TestIsType.Path)) {
  1289.               goto EXIT_23;
  1290.             }
  1291.             if (!IsSameType(yyP21->U_1.V_99.TestIsType.TypeDesc, yyP20->U_1.V_99.TestIsType.TypeDesc)) {
  1292.               goto EXIT_23;
  1293.             }
  1294.             return TRUE;
  1295.           }
  1296.         }
  1297.       } EXIT_23:;
  1298.     }
  1299.   }
  1300.   if (yyP21->U_1.V_1.Kind == Tree_TestNil) {
  1301.     if (yyP20->U_1.V_1.Kind == Tree_TestNil) {
  1302.       for (;;) {
  1303.         {
  1304.           register Tree_yTestNil *W_64 = &yyP21->U_1.V_100.TestNil;
  1305.  
  1306.           {
  1307.             register Tree_yTestNil *W_65 = &yyP20->U_1.V_100.TestNil;
  1308.  
  1309.             if (!IsSamePath(yyP21->U_1.V_100.TestNil.Path, yyP20->U_1.V_100.TestNil.Path)) {
  1310.               goto EXIT_24;
  1311.             }
  1312.             return TRUE;
  1313.           }
  1314.         }
  1315.       } EXIT_24:;
  1316.     }
  1317.   }
  1318.   if (yyP21->U_1.V_1.Kind == Tree_TestNonlin) {
  1319.     if (yyP20->U_1.V_1.Kind == Tree_TestNonlin) {
  1320.       for (;;) {
  1321.         {
  1322.           register Tree_yTestNonlin *W_66 = &yyP21->U_1.V_101.TestNonlin;
  1323.  
  1324.           {
  1325.             register Tree_yTestNonlin *W_67 = &yyP20->U_1.V_101.TestNonlin;
  1326.  
  1327.             if (!IsSamePath(yyP21->U_1.V_101.TestNonlin.Path, yyP20->U_1.V_101.TestNonlin.Path)) {
  1328.               goto EXIT_25;
  1329.             }
  1330.             if (!IsSamePath(yyP21->U_1.V_101.TestNonlin.Path2, yyP20->U_1.V_101.TestNonlin.Path2)) {
  1331.               goto EXIT_25;
  1332.             }
  1333.             return TRUE;
  1334.           }
  1335.         }
  1336.       } EXIT_25:;
  1337.     }
  1338.   }
  1339.   return FALSE;
  1340. }
  1341.  
  1342. static void BuildTree
  1343. # ifdef __STDC__
  1344. (Tree_tTree yyP23, Tree_tTree yyP22, Tree_tTree *yyP24)
  1345. # else
  1346. (yyP23, yyP22, yyP24)
  1347. Tree_tTree yyP23;
  1348. Tree_tTree yyP22;
  1349. Tree_tTree *yyP24;
  1350. # endif
  1351. {
  1352.   struct S_24 yyTempo;
  1353.  
  1354.   if (yyP23->U_1.V_1.Kind == Tree_Rule) {
  1355.     {
  1356.       register struct S_25 *W_68 = &yyTempo.U_1.V_1.yyR1;
  1357.  
  1358.       {
  1359.         register Tree_yRule *W_69 = &yyP23->U_1.V_42.Rule;
  1360.  
  1361.         gRule = yyP23;
  1362.         BuildTree2(W_69->Tests, yyP22, &W_68->yyV1);
  1363.         UpdateChange(W_68->yyV1, gRule);
  1364.         BuildTree(W_69->Next, W_68->yyV1, &W_68->yyV2);
  1365.         *yyP24 = W_68->yyV2;
  1366.         return;
  1367.       }
  1368.     }
  1369.   }
  1370.   if (yyP23->U_1.V_1.Kind == Tree_NoRule) {
  1371.     *yyP24 = yyP22;
  1372.     return;
  1373.   }
  1374. }
  1375.  
  1376. static void BuildTree2
  1377. # ifdef __STDC__
  1378. (Tree_tTree t, Tree_tTree d, Tree_tTree *yyP25)
  1379. # else
  1380. (t, d, yyP25)
  1381. Tree_tTree t;
  1382. Tree_tTree d;
  1383. Tree_tTree *yyP25;
  1384. # endif
  1385. {
  1386.   struct S_26 yyTempo;
  1387.  
  1388.   if (Tree_IsType(t, Tree_OneTest)) {
  1389.     if (d->U_1.V_1.Kind == Tree_NoDecision) {
  1390.       {
  1391.         register struct S_32 *W_70 = &yyTempo.U_1.V_1.yyR1;
  1392.  
  1393.         {
  1394.           register Tree_yOneTest *W_71 = &t->U_1.V_97.OneTest;
  1395.  
  1396.           {
  1397.             register Tree_yNoDecision *W_72 = &d->U_1.V_104.NoDecision;
  1398.  
  1399.             BuildTree2(t->U_1.V_97.OneTest.Next, d, &W_70->yyV1);
  1400.             UpdateChange(W_70->yyV1, gRule);
  1401.             *yyP25 = (Tree_tTree)Tree_yyPoolFreePtr;
  1402.             if ((ADDRESS)(*yyP25) >= Tree_yyPoolMaxPtr) {
  1403.               *yyP25 = Tree_yyAlloc();
  1404.             }
  1405.             INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_Decision]);
  1406.             (*yyP25)->U_1.V_2.yyHead.yyMark = 0;
  1407.             (*yyP25)->U_1.V_1.Kind = Tree_Decision;
  1408.             {
  1409.               register Tree_yDecision *W_73 = &(*yyP25)->U_1.V_105.Decision;
  1410.  
  1411.               W_73->Then = W_70->yyV1;
  1412.               W_73->Else = d;
  1413.               W_73->OneTest = t;
  1414.               W_73->Cases = 0;
  1415.               W_73->IsUnchanged = TRUE;
  1416.             }
  1417.             return;
  1418.           }
  1419.         }
  1420.       }
  1421.     }
  1422.     if (d->U_1.V_1.Kind == Tree_Decision) {
  1423.       {
  1424.         register struct S_31 *W_74 = &yyTempo.U_1.V_2.yyR2;
  1425.  
  1426.         if (d->U_1.V_105.Decision.IsUnchanged == TRUE) {
  1427.           for (;;) {
  1428.             {
  1429.               register Tree_yOneTest *W_75 = &t->U_1.V_97.OneTest;
  1430.  
  1431.               {
  1432.                 register Tree_yDecision *W_76 = &d->U_1.V_105.Decision;
  1433.  
  1434.                 if (!IsSameTest(t, d->U_1.V_105.Decision.OneTest)) {
  1435.                   goto EXIT_26;
  1436.                 }
  1437.                 if (!!HasInterference(t, d->U_1.V_105.Decision.Else)) {
  1438.                   goto EXIT_26;
  1439.                 }
  1440.                 BuildTree2(t->U_1.V_97.OneTest.Next, d->U_1.V_105.Decision.Then, &W_74->yyV1);
  1441.                 d->U_1.V_105.Decision.Then = W_74->yyV1;
  1442.                 UpdateChange(W_74->yyV1, gRule);
  1443.                 *yyP25 = d;
  1444.                 return;
  1445.               }
  1446.             }
  1447.           } EXIT_26:;
  1448.         }
  1449.       }
  1450.       {
  1451.         register struct S_30 *W_77 = &yyTempo.U_1.V_3.yyR3;
  1452.  
  1453.         {
  1454.           register Tree_yOneTest *W_78 = &t->U_1.V_97.OneTest;
  1455.  
  1456.           {
  1457.             register Tree_yDecision *W_79 = &d->U_1.V_105.Decision;
  1458.  
  1459.             BuildTree2(t, d->U_1.V_105.Decision.Else, &W_77->yyV1);
  1460.             d->U_1.V_105.Decision.Else = W_77->yyV1;
  1461.             UpdateChange(W_77->yyV1, gRule);
  1462.             *yyP25 = d;
  1463.             return;
  1464.           }
  1465.         }
  1466.       }
  1467.     }
  1468.     if (d->U_1.V_1.Kind == Tree_Decided) {
  1469.       {
  1470.         register struct S_29 *W_80 = &yyTempo.U_1.V_4.yyR4;
  1471.  
  1472.         {
  1473.           register Tree_yOneTest *W_81 = &t->U_1.V_97.OneTest;
  1474.  
  1475.           {
  1476.             register Tree_yDecided *W_82 = &d->U_1.V_106.Decided;
  1477.  
  1478.             BuildTree2(t, d->U_1.V_106.Decided.Else, &W_80->yyV1);
  1479.             d->U_1.V_106.Decided.Else = W_80->yyV1;
  1480.             UpdateChange(W_80->yyV1, gRule);
  1481.             *yyP25 = d;
  1482.             return;
  1483.           }
  1484.         }
  1485.       }
  1486.     }
  1487.   }
  1488.   if (t->U_1.V_1.Kind == Tree_NoTest) {
  1489.     if (d->U_1.V_1.Kind == Tree_NoDecision) {
  1490.       *yyP25 = (Tree_tTree)Tree_yyPoolFreePtr;
  1491.       if ((ADDRESS)(*yyP25) >= Tree_yyPoolMaxPtr) {
  1492.         *yyP25 = Tree_yyAlloc();
  1493.       }
  1494.       INC1(Tree_yyPoolFreePtr, Tree_yyNodeSize.A[Tree_Decided]);
  1495.       (*yyP25)->U_1.V_2.yyHead.yyMark = 0;
  1496.       (*yyP25)->U_1.V_1.Kind = Tree_Decided;
  1497.       {
  1498.         register Tree_yDecided *W_83 = &(*yyP25)->U_1.V_106.Decided;
  1499.  
  1500.         W_83->Else = d;
  1501.         W_83->Rule = gRule;
  1502.       }
  1503.       return;
  1504.     }
  1505.     if (d->U_1.V_1.Kind == Tree_Decision) {
  1506.       {
  1507.         register struct S_28 *W_84 = &yyTempo.U_1.V_5.yyR6;
  1508.  
  1509.         {
  1510.           register Tree_yNoTest *W_85 = &t->U_1.V_96.NoTest;
  1511.  
  1512.           {
  1513.             register Tree_yDecision *W_86 = &d->U_1.V_105.Decision;
  1514.  
  1515.             BuildTree2(t, d->U_1.V_105.Decision.Else, &W_84->yyV1);
  1516.             d->U_1.V_105.Decision.Else = W_84->yyV1;
  1517.             *yyP25 = d;
  1518.             return;
  1519.           }
  1520.         }
  1521.       }
  1522.     }
  1523.     if (d->U_1.V_1.Kind == Tree_Decided) {
  1524.       {
  1525.         register struct S_27 *W_87 = &yyTempo.U_1.V_6.yyR7;
  1526.  
  1527.         {
  1528.           register Tree_yNoTest *W_88 = &t->U_1.V_96.NoTest;
  1529.  
  1530.           {
  1531.             register Tree_yDecided *W_89 = &d->U_1.V_106.Decided;
  1532.  
  1533.             BuildTree2(t, d->U_1.V_106.Decided.Else, &W_87->yyV1);
  1534.             d->U_1.V_106.Decided.Else = W_87->yyV1;
  1535.             *yyP25 = d;
  1536.             return;
  1537.           }
  1538.         }
  1539.       }
  1540.     }
  1541.   }
  1542. }
  1543.  
  1544. static BOOLEAN HasInterference
  1545. # ifdef __STDC__
  1546. (Tree_tTree yyP27, Tree_tTree yyP26)
  1547. # else
  1548. (yyP27, yyP26)
  1549. Tree_tTree yyP27;
  1550. Tree_tTree yyP26;
  1551. # endif
  1552. {
  1553.   struct S_33 yyTempo;
  1554.  
  1555.   if (yyP26->U_1.V_1.Kind == Tree_Decided) {
  1556.     return TRUE;
  1557.   }
  1558.   if (yyP27->U_1.V_1.Kind == Tree_TestKind) {
  1559.     if (yyP26->U_1.V_1.Kind == Tree_Decision) {
  1560.       if (yyP26->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestKind) {
  1561.         for (;;) {
  1562.           {
  1563.             register Tree_yTestKind *W_90 = &yyP27->U_1.V_98.TestKind;
  1564.  
  1565.             {
  1566.               register Tree_yDecision *W_91 = &yyP26->U_1.V_105.Decision;
  1567.  
  1568.               if (!IsSamePath(yyP27->U_1.V_98.TestKind.Path, yyP26->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path)) {
  1569.                 goto EXIT_27;
  1570.               }
  1571.               if (!!IsDisjoint(yyP27->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types, yyP26->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types)) {
  1572.                 goto EXIT_27;
  1573.               }
  1574.               return TRUE;
  1575.             }
  1576.           }
  1577.         } EXIT_27:;
  1578.       }
  1579.       if (yyP26->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestIsType) {
  1580.         for (;;) {
  1581.           {
  1582.             register Tree_yTestKind *W_92 = &yyP27->U_1.V_98.TestKind;
  1583.  
  1584.             {
  1585.               register Tree_yDecision *W_93 = &yyP26->U_1.V_105.Decision;
  1586.  
  1587.               if (!IsSamePath(yyP27->U_1.V_98.TestKind.Path, yyP26->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path)) {
  1588.                 goto EXIT_28;
  1589.               }
  1590.               if (!!IsDisjoint(yyP27->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types, yyP26->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types)) {
  1591.                 goto EXIT_28;
  1592.               }
  1593.               return TRUE;
  1594.             }
  1595.           }
  1596.         } EXIT_28:;
  1597.       }
  1598.     }
  1599.   }
  1600.   if (yyP27->U_1.V_1.Kind == Tree_TestIsType) {
  1601.     if (yyP26->U_1.V_1.Kind == Tree_Decision) {
  1602.       if (yyP26->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestKind) {
  1603.         for (;;) {
  1604.           {
  1605.             register Tree_yTestIsType *W_94 = &yyP27->U_1.V_99.TestIsType;
  1606.  
  1607.             {
  1608.               register Tree_yDecision *W_95 = &yyP26->U_1.V_105.Decision;
  1609.  
  1610.               if (!IsSamePath(yyP27->U_1.V_99.TestIsType.Path, yyP26->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path)) {
  1611.                 goto EXIT_29;
  1612.               }
  1613.               if (!!IsDisjoint(yyP27->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types, yyP26->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types)) {
  1614.                 goto EXIT_29;
  1615.               }
  1616.               return TRUE;
  1617.             }
  1618.           }
  1619.         } EXIT_29:;
  1620.       }
  1621.       if (yyP26->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestIsType) {
  1622.         for (;;) {
  1623.           {
  1624.             register Tree_yTestIsType *W_96 = &yyP27->U_1.V_99.TestIsType;
  1625.  
  1626.             {
  1627.               register Tree_yDecision *W_97 = &yyP26->U_1.V_105.Decision;
  1628.  
  1629.               if (!IsSamePath(yyP27->U_1.V_99.TestIsType.Path, yyP26->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path)) {
  1630.                 goto EXIT_30;
  1631.               }
  1632.               if (!!IsDisjoint(yyP27->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types, yyP26->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types)) {
  1633.                 goto EXIT_30;
  1634.               }
  1635.               return TRUE;
  1636.             }
  1637.           }
  1638.         } EXIT_30:;
  1639.       }
  1640.     }
  1641.   }
  1642.   if (yyP26->U_1.V_1.Kind == Tree_Decision) {
  1643.     for (;;) {
  1644.       {
  1645.         register Tree_yDecision *W_98 = &yyP26->U_1.V_105.Decision;
  1646.  
  1647.         if (!HasInterference(yyP27, yyP26->U_1.V_105.Decision.Else)) {
  1648.           goto EXIT_31;
  1649.         }
  1650.         return TRUE;
  1651.       }
  1652.     } EXIT_31:;
  1653.   }
  1654.   return FALSE;
  1655. }
  1656.  
  1657. static void UpdateChange
  1658. # ifdef __STDC__
  1659. (Tree_tTree yyP29, Tree_tTree yyP28)
  1660. # else
  1661. (yyP29, yyP28)
  1662. Tree_tTree yyP29;
  1663. Tree_tTree yyP28;
  1664. # endif
  1665. {
  1666.   struct S_34 yyTempo;
  1667.  
  1668.   if (yyP29->U_1.V_1.Kind == Tree_Decision) {
  1669.     if (yyP29->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestKind) {
  1670.       if (yyP28->U_1.V_42.Rule.HasExit == TRUE) {
  1671.         if (yyP28->U_1.V_42.Rule.HasAssign == TRUE) {
  1672.           for (;;) {
  1673.             {
  1674.               register Tree_yDecision *W_99 = &yyP29->U_1.V_105.Decision;
  1675.  
  1676.               {
  1677.                 register Tree_yRule *W_100 = &yyP28->U_1.V_42.Rule;
  1678.  
  1679.                 if (!IsChanged(yyP29->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path, yyP28->U_1.V_42.Rule.Statements)) {
  1680.                   goto EXIT_32;
  1681.                 }
  1682.                 yyP29->U_1.V_105.Decision.IsUnchanged = FALSE;
  1683.                 return;
  1684.               }
  1685.             }
  1686.           } EXIT_32:;
  1687.         }
  1688.       }
  1689.     }
  1690.     if (yyP29->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestIsType) {
  1691.       if (yyP28->U_1.V_42.Rule.HasExit == TRUE) {
  1692.         if (yyP28->U_1.V_42.Rule.HasAssign == TRUE) {
  1693.           for (;;) {
  1694.             {
  1695.               register Tree_yDecision *W_101 = &yyP29->U_1.V_105.Decision;
  1696.  
  1697.               {
  1698.                 register Tree_yRule *W_102 = &yyP28->U_1.V_42.Rule;
  1699.  
  1700.                 if (!IsChanged(yyP29->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path, yyP28->U_1.V_42.Rule.Statements)) {
  1701.                   goto EXIT_33;
  1702.                 }
  1703.                 yyP29->U_1.V_105.Decision.IsUnchanged = FALSE;
  1704.                 return;
  1705.               }
  1706.             }
  1707.           } EXIT_33:;
  1708.         }
  1709.       }
  1710.     }
  1711.   }
  1712. }
  1713.  
  1714. static BOOLEAN IsChanged
  1715. # ifdef __STDC__
  1716. (Tree_tTree yyP31, Tree_tTree yyP30)
  1717. # else
  1718. (yyP31, yyP30)
  1719. Tree_tTree yyP31;
  1720. Tree_tTree yyP30;
  1721. # endif
  1722. {
  1723.   struct S_35 yyTempo;
  1724.  
  1725.   if (yyP30->U_1.V_1.Kind == Tree_Assignment) {
  1726.     for (;;) {
  1727.       {
  1728.         register Tree_yAssignment *W_103 = &yyP30->U_1.V_78.Assignment;
  1729.  
  1730.         if (!(yyP30->U_1.V_78.Assignment.Object != NIL)) {
  1731.           goto EXIT_34;
  1732.         }
  1733.         if (!IsSamePath(yyP31, yyP30->U_1.V_78.Assignment.Object->U_1.V_86.Formal.Path)) {
  1734.           goto EXIT_34;
  1735.         }
  1736.         return TRUE;
  1737.       }
  1738.     } EXIT_34:;
  1739.   }
  1740.   if (Tree_IsType(yyP30, Tree_Statement)) {
  1741.     for (;;) {
  1742.       {
  1743.         register Tree_yStatement *W_104 = &yyP30->U_1.V_75.Statement;
  1744.  
  1745.         if (!IsChanged(yyP31, yyP30->U_1.V_75.Statement.Next)) {
  1746.           goto EXIT_35;
  1747.         }
  1748.         return TRUE;
  1749.       }
  1750.     } EXIT_35:;
  1751.   }
  1752.   return FALSE;
  1753. }
  1754.  
  1755. static void FindCases
  1756. # ifdef __STDC__
  1757. (Tree_tTree yyP32, Tree_tTree *yyP35, SHORTCARD *yyP34, Sets_tSet *yyP33)
  1758. # else
  1759. (yyP32, yyP35, yyP34, yyP33)
  1760. Tree_tTree yyP32;
  1761. Tree_tTree *yyP35;
  1762. SHORTCARD *yyP34;
  1763. Sets_tSet *yyP33;
  1764. # endif
  1765. {
  1766.   struct S_36 yyTempo;
  1767.  
  1768.   if (yyP32->U_1.V_1.Kind == Tree_Decision) {
  1769.     if (yyP32->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestKind) {
  1770.       {
  1771.         register struct S_40 *W_105 = &yyTempo.U_1.V_1.yyR1;
  1772.  
  1773.         {
  1774.           register Tree_yDecision *W_106 = &yyP32->U_1.V_105.Decision;
  1775.  
  1776.           FindCases(yyP32->U_1.V_105.Decision.Then, &W_105->yyV1, &W_105->yyV2, &W_105->yyV3);
  1777.           MarkCases(yyP32->U_1.V_105.Decision.Then, W_105->yyV2, W_105->yyV3);
  1778.           FindCases(yyP32->U_1.V_105.Decision.Else, &W_105->yyV4, &W_105->yyV5, &W_105->yyV6);
  1779.           if (W_105->yyV5 == 0) {
  1780.             W_105->k = 1;
  1781.             Sets_MakeSet(&W_105->s, (LONGCARD)yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1782.             Sets_Assign(&W_105->s, yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types);
  1783.           } else if (IsSamePath(yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path, W_105->yyV4) && IsDisjoint(W_105->yyV6, yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types)) {
  1784.             W_105->k = W_105->yyV5 + 1;
  1785.             W_105->s = W_105->yyV6;
  1786.             Sets_Union(&W_105->s, yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types);
  1787.           } else {
  1788.             MarkCases(yyP32->U_1.V_105.Decision.Else, W_105->yyV5, W_105->yyV6);
  1789.             W_105->k = 1;
  1790.             Sets_MakeSet(&W_105->s, (LONGCARD)yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1791.             Sets_Assign(&W_105->s, yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types);
  1792.           }
  1793.           *yyP35 = yyP32->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path;
  1794.           *yyP34 = W_105->k;
  1795.           *yyP33 = W_105->s;
  1796.           return;
  1797.         }
  1798.       }
  1799.     }
  1800.     if (yyP32->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestIsType) {
  1801.       {
  1802.         register struct S_39 *W_107 = &yyTempo.U_1.V_2.yyR2;
  1803.  
  1804.         {
  1805.           register Tree_yDecision *W_108 = &yyP32->U_1.V_105.Decision;
  1806.  
  1807.           FindCases(yyP32->U_1.V_105.Decision.Then, &W_107->yyV1, &W_107->yyV2, &W_107->yyV3);
  1808.           MarkCases(yyP32->U_1.V_105.Decision.Then, W_107->yyV2, W_107->yyV3);
  1809.           FindCases(yyP32->U_1.V_105.Decision.Else, &W_107->yyV4, &W_107->yyV5, &W_107->yyV6);
  1810.           if (W_107->yyV5 == 0) {
  1811.             W_107->k = 1;
  1812.             Sets_MakeSet(&W_107->s, (LONGCARD)yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1813.             Sets_Assign(&W_107->s, yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types);
  1814.           } else if (IsSamePath(yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path, W_107->yyV4) && IsDisjoint(W_107->yyV6, yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types)) {
  1815.             W_107->k = W_107->yyV5 + 1;
  1816.             W_107->s = W_107->yyV6;
  1817.             Sets_Union(&W_107->s, yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types);
  1818.           } else {
  1819.             MarkCases(yyP32->U_1.V_105.Decision.Else, W_107->yyV5, W_107->yyV6);
  1820.             W_107->k = 1;
  1821.             Sets_MakeSet(&W_107->s, (LONGCARD)yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1822.             Sets_Assign(&W_107->s, yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types);
  1823.           }
  1824.           *yyP35 = yyP32->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path;
  1825.           *yyP34 = W_107->k;
  1826.           *yyP33 = W_107->s;
  1827.           return;
  1828.         }
  1829.       }
  1830.     }
  1831.     {
  1832.       register struct S_38 *W_109 = &yyTempo.U_1.V_3.yyR3;
  1833.  
  1834.       {
  1835.         register Tree_yDecision *W_110 = &yyP32->U_1.V_105.Decision;
  1836.  
  1837.         FindCases(yyP32->U_1.V_105.Decision.Then, &W_109->yyV1, &W_109->yyV2, &W_109->yyV3);
  1838.         MarkCases(yyP32->U_1.V_105.Decision.Then, W_109->yyV2, W_109->yyV3);
  1839.         FindCases(yyP32->U_1.V_105.Decision.Else, &W_109->yyV4, &W_109->yyV5, &W_109->yyV6);
  1840.         MarkCases(yyP32->U_1.V_105.Decision.Else, W_109->yyV5, W_109->yyV6);
  1841.         *yyP35 = NIL;
  1842.         *yyP34 = 0;
  1843.         return;
  1844.       }
  1845.     }
  1846.   }
  1847.   if (yyP32->U_1.V_1.Kind == Tree_Decided) {
  1848.     {
  1849.       register struct S_37 *W_111 = &yyTempo.U_1.V_4.yyR4;
  1850.  
  1851.       {
  1852.         register Tree_yDecided *W_112 = &yyP32->U_1.V_106.Decided;
  1853.  
  1854.         FindCases(yyP32->U_1.V_106.Decided.Else, &W_111->yyV1, &W_111->yyV2, &W_111->yyV3);
  1855.         MarkCases(yyP32->U_1.V_106.Decided.Else, W_111->yyV2, W_111->yyV3);
  1856.         *yyP35 = NIL;
  1857.         *yyP34 = 0;
  1858.         return;
  1859.       }
  1860.     }
  1861.   }
  1862.   if (yyP32->U_1.V_1.Kind == Tree_NoDecision) {
  1863.     *yyP35 = NIL;
  1864.     *yyP34 = 0;
  1865.     return;
  1866.   }
  1867. }
  1868.  
  1869. static void MarkCases
  1870. # ifdef __STDC__
  1871. (Tree_tTree yyP38, SHORTCARD yyP37, Sets_tSet yyP36)
  1872. # else
  1873. (yyP38, yyP37, yyP36)
  1874. Tree_tTree yyP38;
  1875. SHORTCARD yyP37;
  1876. Sets_tSet yyP36;
  1877. # endif
  1878. {
  1879.   struct S_41 yyTempo;
  1880.  
  1881.   if (yyP38->U_1.V_1.Kind == Tree_Decision) {
  1882.     for (;;) {
  1883.       {
  1884.         register Tree_yDecision *W_113 = &yyP38->U_1.V_105.Decision;
  1885.  
  1886.         if (!(yyP37 >= 7)) {
  1887.           goto EXIT_36;
  1888.         }
  1889.         yyP38->U_1.V_105.Decision.Cases = yyP37;
  1890.         Sets_ReleaseSet(&yyP36);
  1891.         return;
  1892.       }
  1893.     } EXIT_36:;
  1894.   }
  1895. }
  1896.  
  1897. static void ElimDeadTests
  1898. # ifdef __STDC__
  1899. (Tree_tTree yyP42, Tree_tTree yyP41, BOOLEAN yyP40, Sets_tSet yyP39)
  1900. # else
  1901. (yyP42, yyP41, yyP40, yyP39)
  1902. Tree_tTree yyP42;
  1903. Tree_tTree yyP41;
  1904. BOOLEAN yyP40;
  1905. Sets_tSet yyP39;
  1906. # endif
  1907. {
  1908.   struct S_42 yyTempo;
  1909.  
  1910.   if (yyP42->U_1.V_1.Kind == Tree_Decision) {
  1911.     if (yyP42->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestKind) {
  1912.       {
  1913.         register struct S_48 *W_114 = &yyTempo.U_1.V_1.yyR1;
  1914.  
  1915.         if (yyP40 == FALSE) {
  1916.           {
  1917.             register Tree_yDecision *W_115 = &yyP42->U_1.V_105.Decision;
  1918.  
  1919.             Sets_MakeSet(&W_114->s, (LONGCARD)yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1920.             if (IsDeadEnd(yyP42->U_1.V_105.Decision.Then)) {
  1921.               Sets_Assign(&W_114->s, yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types);
  1922.             }
  1923.             ElimDeadTests(yyP42->U_1.V_105.Decision.Else, yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path, TRUE, W_114->s);
  1924.             ElimDeadTests(yyP42->U_1.V_105.Decision.Then, W_114->yyV1, FALSE, W_114->yyV2);
  1925.             return;
  1926.           }
  1927.         }
  1928.       }
  1929.       {
  1930.         register struct S_46 *W_116 = &yyTempo.U_1.V_3.yyR3;
  1931.  
  1932.         {
  1933.           register Tree_yDecision *W_117 = &yyP42->U_1.V_105.Decision;
  1934.  
  1935.           W_116->s2 = yyP39;
  1936.           if (IsSamePath(yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path, yyP41)) {
  1937.             if (!IsDisjoint(yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types, yyP39)) {
  1938.               W_116->types = yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types;
  1939.               yyP42->U_1.V_105.Decision.OneTest = Tree_mTestIsType(yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Next, yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path, Tree_mNodeTypes(yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.TreeName, W_116->types), yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Name);
  1940.               Sets_MakeSet(&yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types, (LONGCARD)yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1941.               Sets_Assign(&yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types, W_116->types);
  1942.               Sets_Difference(&yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types, yyP39);
  1943.             }
  1944.           } else {
  1945.             Sets_AssignEmpty(&W_116->s2);
  1946.           }
  1947.           if (IsDeadEnd(yyP42->U_1.V_105.Decision.Then)) {
  1948.             Sets_Union(&W_116->s2, yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.TypeDesc->U_1.V_89.NodeTypes.Types);
  1949.           }
  1950.           ElimDeadTests(yyP42->U_1.V_105.Decision.Else, yyP42->U_1.V_105.Decision.OneTest->U_1.V_98.TestKind.Path, TRUE, W_116->s2);
  1951.           ElimDeadTests(yyP42->U_1.V_105.Decision.Then, W_116->yyV1, FALSE, W_116->yyV2);
  1952.           return;
  1953.         }
  1954.       }
  1955.     }
  1956.     if (yyP42->U_1.V_105.Decision.OneTest->U_1.V_1.Kind == Tree_TestIsType) {
  1957.       {
  1958.         register struct S_47 *W_118 = &yyTempo.U_1.V_2.yyR2;
  1959.  
  1960.         if (yyP40 == FALSE) {
  1961.           {
  1962.             register Tree_yDecision *W_119 = &yyP42->U_1.V_105.Decision;
  1963.  
  1964.             Sets_MakeSet(&W_118->s, (LONGCARD)yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1965.             if (IsDeadEnd(yyP42->U_1.V_105.Decision.Then)) {
  1966.               Sets_Assign(&W_118->s, yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types);
  1967.             }
  1968.             ElimDeadTests(yyP42->U_1.V_105.Decision.Else, yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path, TRUE, W_118->s);
  1969.             ElimDeadTests(yyP42->U_1.V_105.Decision.Then, W_118->yyV1, FALSE, W_118->yyV2);
  1970.             return;
  1971.           }
  1972.         }
  1973.       }
  1974.       {
  1975.         register struct S_45 *W_120 = &yyTempo.U_1.V_4.yyR4;
  1976.  
  1977.         {
  1978.           register Tree_yDecision *W_121 = &yyP42->U_1.V_105.Decision;
  1979.  
  1980.           W_120->s2 = yyP39;
  1981.           if (IsSamePath(yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path, yyP41)) {
  1982.             if (!IsDisjoint(yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types, yyP39)) {
  1983.               W_120->types = yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types;
  1984.               yyP42->U_1.V_105.Decision.OneTest = Tree_mTestIsType(yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Next, yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path, Tree_mNodeTypes(yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.TreeName, W_120->types), yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Name);
  1985.               Sets_MakeSet(&yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types, (LONGCARD)yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.TreeName->U_1.V_29.TreeName.ClassCount);
  1986.               Sets_Assign(&yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types, W_120->types);
  1987.               Sets_Difference(&yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types, yyP39);
  1988.             }
  1989.           } else {
  1990.             Sets_AssignEmpty(&W_120->s2);
  1991.           }
  1992.           if (IsDeadEnd(yyP42->U_1.V_105.Decision.Then)) {
  1993.             Sets_Union(&W_120->s2, yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.TypeDesc->U_1.V_89.NodeTypes.Types);
  1994.           }
  1995.           ElimDeadTests(yyP42->U_1.V_105.Decision.Else, yyP42->U_1.V_105.Decision.OneTest->U_1.V_99.TestIsType.Path, TRUE, W_120->s2);
  1996.           ElimDeadTests(yyP42->U_1.V_105.Decision.Then, W_120->yyV1, FALSE, W_120->yyV2);
  1997.           return;
  1998.         }
  1999.       }
  2000.     }
  2001.     {
  2002.       register struct S_44 *W_122 = &yyTempo.U_1.V_5.yyR5;
  2003.  
  2004.       {
  2005.         register Tree_yDecision *W_123 = &yyP42->U_1.V_105.Decision;
  2006.  
  2007.         if (yyP40) {
  2008.           Sets_ReleaseSet(&yyP39);
  2009.         }
  2010.         ElimDeadTests(yyP42->U_1.V_105.Decision.Else, W_122->yyV1, FALSE, W_122->yyV2);
  2011.         ElimDeadTests(yyP42->U_1.V_105.Decision.Then, W_122->yyV3, FALSE, W_122->yyV4);
  2012.         return;
  2013.       }
  2014.     }
  2015.   }
  2016.   if (yyP42->U_1.V_1.Kind == Tree_Decided) {
  2017.     {
  2018.       register struct S_43 *W_124 = &yyTempo.U_1.V_6.yyR6;
  2019.  
  2020.       {
  2021.         register Tree_yDecided *W_125 = &yyP42->U_1.V_106.Decided;
  2022.  
  2023.         if (yyP40) {
  2024.           Sets_ReleaseSet(&yyP39);
  2025.         }
  2026.         if (!yyP42->U_1.V_106.Decided.Rule->U_1.V_42.Rule.HasExit) {
  2027.           ReportWarning(yyP42->U_1.V_106.Decided.Else);
  2028.         }
  2029.         ElimDeadTests(yyP42->U_1.V_106.Decided.Else, W_124->yyV1, FALSE, W_124->yyV2);
  2030.         return;
  2031.       }
  2032.     }
  2033.   }
  2034.   if (yyP42->U_1.V_1.Kind == Tree_NoDecision) {
  2035.     if (yyP40 == TRUE) {
  2036.       {
  2037.         register Tree_yNoDecision *W_126 = &yyP42->U_1.V_104.NoDecision;
  2038.  
  2039.         Sets_ReleaseSet(&yyP39);
  2040.         return;
  2041.       }
  2042.     }
  2043.   }
  2044. }
  2045.  
  2046. static BOOLEAN IsDeadEnd
  2047. # ifdef __STDC__
  2048. (Tree_tTree yyP43)
  2049. # else
  2050. (yyP43)
  2051. Tree_tTree yyP43;
  2052. # endif
  2053. {
  2054.   struct S_49 yyTempo;
  2055.  
  2056.   if (yyP43->U_1.V_1.Kind == Tree_Decided) {
  2057.     for (;;) {
  2058.       {
  2059.         register Tree_yDecided *W_127 = &yyP43->U_1.V_106.Decided;
  2060.  
  2061.         if (!(!yyP43->U_1.V_106.Decided.Rule->U_1.V_42.Rule.HasExit || IsDeadEnd(yyP43->U_1.V_106.Decided.Else))) {
  2062.           goto EXIT_37;
  2063.         }
  2064.         return TRUE;
  2065.       }
  2066.     } EXIT_37:;
  2067.   }
  2068.   return FALSE;
  2069. }
  2070.  
  2071. static void ReportWarning
  2072. # ifdef __STDC__
  2073. (Tree_tTree yyP44)
  2074. # else
  2075. (yyP44)
  2076. Tree_tTree yyP44;
  2077. # endif
  2078. {
  2079.   struct S_50 yyTempo;
  2080.  
  2081.   if (yyP44->U_1.V_1.Kind == Tree_Decided) {
  2082.     {
  2083.       register Tree_yDecided *W_128 = &yyP44->U_1.V_106.Decided;
  2084.  
  2085.       Scanner_Warning((STRING)"unreachable code", 16L, yyP44->U_1.V_106.Decided.Rule->U_1.V_42.Rule.Line);
  2086.       ReportWarning(yyP44->U_1.V_106.Decided.Else);
  2087.       return;
  2088.     }
  2089.   }
  2090.   if (yyP44->U_1.V_1.Kind == Tree_Decision) {
  2091.     {
  2092.       register Tree_yDecision *W_129 = &yyP44->U_1.V_105.Decision;
  2093.  
  2094.       ReportWarning(yyP44->U_1.V_105.Decision.Then);
  2095.       ReportWarning(yyP44->U_1.V_105.Decision.Else);
  2096.       return;
  2097.     }
  2098.   }
  2099. }
  2100.  
  2101. void Optimize_BeginOptimize
  2102. # ifdef __STDC__
  2103. ()
  2104. # else
  2105. ()
  2106. # endif
  2107. {
  2108. }
  2109.  
  2110. void Optimize_CloseOptimize
  2111. # ifdef __STDC__
  2112. ()
  2113. # else
  2114. ()
  2115. # endif
  2116. {
  2117. }
  2118.  
  2119. static void yyExit
  2120. # ifdef __STDC__
  2121. ()
  2122. # else
  2123. ()
  2124. # endif
  2125. {
  2126.   IO_CloseIO();
  2127.   Exit(1L);
  2128. }
  2129.  
  2130. void BEGIN_Optimize()
  2131. {
  2132.   static BOOLEAN has_been_called = FALSE;
  2133.  
  2134.   if (!has_been_called) {
  2135.     has_been_called = TRUE;
  2136.  
  2137.     BEGIN_IO();
  2138.     BEGIN_Tree();
  2139.     BEGIN_System();
  2140.     BEGIN_IO();
  2141.     BEGIN_Tree();
  2142.     BEGIN_IO();
  2143.     BEGIN_Idents();
  2144.     BEGIN_Mod();
  2145.     BEGIN_Tree();
  2146.     BEGIN_Scanner();
  2147.     BEGIN_Positions();
  2148.     BEGIN_Sets();
  2149.     BEGIN_Sets();
  2150.  
  2151.     Optimize_yyf = IO_StdOutput;
  2152.     Optimize_Exit = yyExit;
  2153.     Optimize_BeginOptimize();
  2154.   }
  2155. }
  2156.